package net.huashitong.ssydt.provider.article.service;


import net.huashitong.ssydt.article.entity.SsArticleCollection;
import net.huashitong.ssydt.article.entity.vo.CollectionsQueryVO;
import net.huashitong.ssydt.provider.article.mapper.SsArticleCollectionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author <a href="mailto:yhy23456@163.com">huiyang.yu</a>
 * @since 2017.09.22
 */
@Service
@Transactional
public class SsArticleCollectionServiceImpl implements SsArticleCollectionService {

    private SsArticleCollectionMapper mapper;

    @Autowired
    public SsArticleCollectionServiceImpl(SsArticleCollectionMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(SsArticleCollection record) {
        return mapper.insert(record);
    }

    @Override
    public int insertSelective(SsArticleCollection record) {
        return mapper.insertSelective(record);
    }

    @Override
    public SsArticleCollection selectByPrimaryKey(Long id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(SsArticleCollection record) {
        return mapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(SsArticleCollection record) {
        return mapper.updateByPrimaryKey(record);
    }

    @Override
    public SsArticleCollection getByUserIdWithArticleId(String userId, Long articleId) {
        SsArticleCollection collection = new SsArticleCollection();
        collection.setUserId(userId);
        collection.setArticleId(articleId);
        return mapper.getByUserIdWithArticleId(collection);
    }

    @Override
    public int deleteByUserId(String userId) {
        return mapper.deleteByUserId(userId);
    }

    @Override
    public List<SsArticleCollection> queryByUserId(CollectionsQueryVO collectionsQueryVO) {
        return mapper.queryByUserId(collectionsQueryVO);
    }
}
